<?php
namespace app\admin\model;
use think\Model;
class Project extends Model{

    //添加主页路径
//    public function addHomePath($path,$filename,$projectname,$art_dir_name){
//        $result=$this->insert([
//            'homepath'=>$path,
//            'filename'=>$filename,
//            'projectname'=>$projectname,
//            'art_dir_name'=>$art_dir_name
//        ]);
//
//        return $result;
//    }

    //输出主页路径及模板名称
    public function homePath(){
        $result=$this->where('1=1')->find();
        if ($result){
            $result=$result->toArray();
        }else{
            $result=[];
        }

        return $result;

    }

    //修改配置
    public function updateConfig($id,$path,$filename,$projectname,$art_dir_name,$domain_name){
        $result=$this->where('id','=',$id)->update([
            'homepath'=>$path,
            'filename'=>$filename,
            'projectname'=>$projectname,
            "art_dir_name"=>$art_dir_name,
            "domain_name"=>$domain_name
        ]);

        return $result;

    }


    //输出根目录路径
    public function selectHomePath(){
        $result=$this->where('1=1')->value("homepath");

        return $result;
    }

    /**
     * 输出文章文件夹名称
     * @return float|mixed|string|null
     */
    public function art_dir_name(){
        $result=$this->where('1=1')->value("art_dir_name");

        return $result;
    }

    /**
     * 输出域名信息
     * @return float|mixed|string|null
     */
    public function domain_name(){
        $result=$this->where('1=1')->value("domain_name");

        return $result;
    }
}
